<script setup lang="ts">
const props = defineProps({
  num: {
    type: Number,
    default: 0
  }
})
const emit = defineEmits<{
  (e: 'update:num', val: number): void
}>()
const changeNum = () => {
  emit('update:num', props.num - 1)
}
</script>
<template>
  <div style="border: 2px solid #ccc; padding: 20px">
    tom子组件 -- {{ num }} <button @click="changeNum">change</button>
  </div>
</template>



<style scoped>
</style>